<?php

		
session_start();
if (isset($_GET['destroy'])) {
	session_destroy();
	header('Location: Admin.php ');
}

if (	isset($_POST['username']) 														&&
		isset($_POST['password'])														&&
		!strcmp(sha1($_POST['username']),"b48630ff92ccdb863262a934a8272a6b586031ba") 	&&
		!strcmp(sha1($_POST['password']),"011c945f30ce2cbafc452f39840f025693339c42")) {
	$_SESSION['user']="logged";
}
if (isset($_SESSION['user'])) {
	include('header.php');
	if(isset($_GET['page'])){
		//Get the requested page name
		$page = $_GET['page'];
		 
		//check if the requested page exists
		if(!file_exists('./'. $page . '.php')){
			//It does not exist, so - render a 404(not found) page
			$page = 'admin_index';
		}
		 
	} else {
		//There is no requested page, so render the default one - the Homepage
		$page = 'admin_index';
	}
	 
	
	echo '<div id="main-content">';
	include ($page . '.php');
	echo"</div>";
	include('footer.php');
} else {
	include('login.php');
}